package com.cass.controller;

import com.cass.entity.userFeedback;
import com.cass.service.userFeedbackService;
import com.cass.uilts.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.logging.Logger;
import org.mybatis.logging.LoggerFactory;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/feedback")
@RestController
@RequiredArgsConstructor
@Slf4j
public class userFeedbackController {
    private static final Logger logger = LoggerFactory.getLogger( TeacherController.class);
    private final userFeedbackService userFeedbackService;
    @PostMapping
    public Result<?> addFeedback(@RequestBody userFeedback userFeedback){
        userFeedbackService.save(userFeedback);
        return Result.success("反馈成功");
    }
    @GetMapping
    public Result<?> getFeedback(){
       return Result.success(userFeedbackService.list());
   }
    @PutMapping()
    public Result<?> updateFeedback(@RequestBody userFeedback userFeedback){
        userFeedbackService.updateById(userFeedback);
        return Result.success("修改成功");
    }
    @DeleteMapping("/{id}")
    public Result<?> deleteFeedback(@PathVariable("id") Integer id){
        userFeedbackService.removeById(id);
        return Result.success("删除成功");
    }

}
